<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<base href="<%=basePath%>">
	
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	<title>信息列表</title>
	 <style type="text/css">
	 	div{
	 		margin-left: 80px;
	 	}
    	h1,p,td,th{
    		text-align: center;
    	}
    	p{
    		font-size: 20px;
    		margin-top: 30px;
    		float:right;
    		
    	}
    	.double,th{
    		background-color: #DDD;
    	}
    	table{
    		width:100%;
    		border: 1px solid #FFF; 
    		font-size: 22px;
    		margin-top: 30px;
    	}
    	a:HOVER {
			color:red;
		}
    </style>
  </head>
  
  <body>
  	<div>
  		<h1>标准信息列表</h1>
  		<table>
		  	<form action="List.html">
		  		<p>
		  			<input type="text" name="name"  value="${name }">&nbsp;&nbsp;
		  			<input type="submit" value="提交检索"/>
		  			<a href="newStand.jsp"><input type="button"value="新增标准"/></a>
		  			<a href="deleteStand.html"><input type="button" value="删除标准"/></a>
		  		</p>
		  	</form>
		  		<tr>
		  			<th><input type="checkbox"></th>
		  			<th>标准号</th>
		  			<th>中文名称</th>
		  			<th>版本</th>
		  			<th>发布日期</th>
		  			<th>实施日期</th>
		  			<th>操作</th>
		  		</tr>
		  		<c:choose>
	  		<c:when test="${empty stands}">
	  			<tr>
	  				<td colspan="6" class="null">没有找到任何图书信息</td>
	  			</tr>
	  		</c:when>
	  		<c:otherwise>
	  			<c:forEach var="s" items="${stands }" varStatus="status">
					<tr <c:if test="${status.index%2==0}"> class="double" </c:if> >
						<td><input type="checkbox" name="id" value="${s.id }"></td>
						<td><a href="#">${s.stdNum }</a></td>
						<td>${s.zhname }</td>
						<td>${s.version }</td>
						<td><fmt:formatDate value="${s.releaseDate }" pattern="yyyy-MM-dd"/></td>
						<td><fmt:formatDate value="${s.implDate }" pattern="yyyy-MM-dd"/></td>	
						<td>
							<a href="Lookinfo?id=${b.bookId }">下载</a>
							<a href="#">修改</a>
						</td>
						
					</tr>  			
	  			</c:forEach>
	  		</c:otherwise>
  		</c:choose>
		</table>
		<tr>
			<td>
				<c:import url="page.jsp">
					<c:param name="pageNo" value="${pageNo}"></c:param>
					<c:param name="pageCount" value="${pageCount}"></c:param>
					<c:param name="pageSize" value="${pageSize}"></c:param>
					<c:param name="totalCount" value="${totalCount}"></c:param>
				</c:import>
				
			</td>
		</tr>
	</div>
	<script type="text/javascript">
		function go(){
			//获取输入的页码
			var pageIndex = parseInt(document.getElementById("pageIndex").value);
			var maxPage = parseInt(document.getElementById("pageCount").value);
			//校验页码输入是否正确
			//格式为数字
			var reg = /^[1-9]{1}[0-9]{0,}$/;
			if(reg.test(pageIndex) && pageIndex<=maxPage){
				//如果验证正确，提交请求
				search(pageIndex);
			}else{
				alert("请输入正确的页码！页码范围为1-"+maxPage+"。");
				document.getElementById("pageIndex").value="";
				document.getElementById("pageIndex").focus();
				return;
			}
		}
		
		function search(pageNo,pageSize){
			if(pageSize){
				document.getElementById("pageSize").value = pageSize;
			}
			document.getElementById("pageNo").value = pageNo;
			document.forms[0].submit();
		}
	
	</script>
	
	 <script type="text/javascript" src="<%=basePath%>static/js/jquery-1.12.4.min.js"></script>
	</body>
</html>